function __ui(){}

__ui.prototype.loading=function(option,callback)
{
	var __elemId;

	if (option.id)
	{
		__elemId=option.id;
	}
	else
	{
		__elemId="ui_loading";
		if(!gE(__elemId))
		{
			var oNewp = $("<div id='"+__elemId+"'/>").html("<div class=\"img\" />"+option.html); 
			oNewp.appendTo(document.body);
		}
		
	}

	var _top=($(window).height())/2+$(document).scrollTop();
	var _left=($(window).width())/2+$(document).scrollLeft();
	var _width=$("#"+__elemId).width();

	if(option.width)
	{
		_width=option.width;
	}

	var _height=$("#"+__elemId).height();

	if(_width==0)
		_width=500;
	if(_height==0)
		_height=80;

	$("#"+__elemId).css({'display':'block','position': "absolute",'top':_top-_height/2,'left':_left-_width/2,'width':_width,'z-index':9999,height:0}); 

	$("#"+__elemId).animate({height:_height,width:_width}, "slow");
	//alert($("#"+__elemId).css);
	if (option.gotourl)
	{
		//location=option.gotourl
		if (!option.timeout)
			option.timeout=3000;
		window.setTimeout(location=option.gotourl,option.timeout);
	}
	if (callback)
	{
		callback();
	}
}

__ui.prototype.popupTips=function(option,callback)
{
	var __elemId;
	if (option.id)
	{
		__elemId=option.id;
		//$ui.popupTips({id:"tip_afterpay"});
	}
	else
	{
		__elemId="ui_popuptips";

		if(!gE(__elemId))
		{
			var oNewp = $("<div id='"+__elemId+"' class='popuptips'/>").html(option.html); 
			oNewp.appendTo(document.body);
		}

	}
	var _top,_left,_width,_height;

	_height=$("#"+__elemId).height();

	if(option.position=="top")
	{
		$("#"+__elemId).css({position:"absolute",top:$(document).scrollTop(),left:0,width:'100%','z-index':999,height:0}); 
	}
	else
	{
		_top=($(window).height())/2+$(document).scrollTop();
		_left=($(window).width())/2+$(document).scrollLeft();
		_width=$("#"+__elemId).width();
		$("#"+__elemId).css({position: "absolute",'top':_top-_height/2,'left':_left-_width/2,'z-index':999,height:0}); 
		
	}
	$("#"+__elemId).stop().animate({height:_height}, "slow").delay(3000).animate({opacity: 'show'},callback);

}

var $ui=new __ui();